package lk2_tests.remoting
{
	import flexunit.framework.TestCase;
	
	import lk2.remoting.RemoteObjectFactory;
	
	import mx.rpc.remoting.RemoteObject;
	
	public class RemoteObjectFactoryTest extends TestCase
	{
		public function test_getRemoteObject():void
		{
			var mockConfigObj:MockConfigObj = new MockConfigObj();
			RemoteObjectFactory.initialize(mockConfigObj);
			var ro:RemoteObject = RemoteObjectFactory.getRemoteObject(RemoteObjectFactory.CFC_CONNECTOR,mockConfigObj.getString("cfc")+"."+mockConfigObj.getString("calendarFacade"));
			
			var compareRO:RemoteObject = new RemoteObject('ColdFusion');
			compareRO.source = mockConfigObj.getString("cfc")+"."+mockConfigObj.getString("calendarFacade");
			
			
			assertEquals("Destination has not been set correctly.", ro.destination,compareRO.destination);
			assertEquals("Source has not been set correctly.", ro.source,compareRO.source);
			assertNotNull("ChannelSet of returned object null",ro.channelSet);
			assertEquals("Check hannel-set, values don't march",ro.channelSet.channels[0].id,mockConfigObj.getString('amf-channel-id'));
		}

	}
}